/*
 * Copyright 2007-2009 Perttu "celeron55" Ahola <celeron55@gmail.com>
 *
 * This file is part of jukumagic.
 *
 * jukumagic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jukumagic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jukumagic.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef FOOTPRINTLIBRARY_H_
#define FOOTPRINTLIBRARY_H_

#include "common.h"
#include "footprintlibrarynode.h"
#include "footprint.h"
#include <list>
#include <wx/wx.h>

class FootprintLibrary : public JukuObject
{
public:
	std::list<FootprintLibraryNode*> m_nodes;
	FootprintLibrary(wxString dirpath);
	FootprintLibrary();
	~FootprintLibrary();
	//return false if failed, true if succeeded
	bool AddFile(const wxString &filepath);
	//bool AddPCBFile(const wxString &filepath);
	//return false if failed, true if succeeded
	bool AddDir(const wxString &dirpath);
	
	void AddNode(FootprintLibraryNode* node);
	void AddFootprint(Footprint* footprint, wxString name);
	//call after adding things, sorts nodes alphabetically
	void Sort();

	std::list<FootprintLibraryNode*> GetMatchingNodes(const wxString &s);
	std::list<Footprint*> GetMatchingFootprints(const wxString &s);

	Footprint* GetFootprint(const wxString &s);
};

#endif
